<?
	require_once "../../_func/__Global.php";
	require_once "../../_func/__Local.php";
	require_once "../../_func/__MysqlFunc.php";
	require_once "../../_func/_MngFunc.php";
	require_once "../../_func/_CodeFunc.php";
	
	//검색어
	$sch_farm_name 	= $param->getString('schVal');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>:: 농협전북지부 ERP시스템 ::</title>
<link href="/css/layout.css" type="text/css" rel="stylesheet" />
<script src="/js/mng.js"></script>
</head>

<body>
<div id="wrap">
	<!-- header start -->
	<? include("../_layout/head.inc"); ?>
	<!-- header end -->
	
<!-- container start -->
	<div id="container">
	
	<!-- sub menu start -->
	<? include("../_layout/left.inc"); ?>
	<!-- sub menu end -->	
	
        <div class="code_contents">
        	<div class="subtit">
        		<p class="subtt21"><span>코드관리 > 농가관리</span></p>
			</div>
<form name=frm id=frm method="POST" action="<?echo $PHP_SELF?>">			
			<table cellpadding="0" cellspacing="0" border="0" class="erpSearch">
            	<tr>
                	<td><span class="txt_farmsearch"></span></td>
                    <td>
                    	<input type="text" id="schVal" name="schVal" value="<?echo $sch_farm_name?>" title="검색어입력" class="boxinput w300" />
                    </td>
                    <td><input type='submit' type="button" class="btn_search" title="조회" value='' />
                    </td>
                </tr>
            </table>
			
			
            <p class="tableTitle"><span class="b"></span>농가 등록</p>
			<div class="BtnList2">
				<p>
				<input type="button" class="btn_excel" onClick="MNG.fncRtnfunc('excel','farm');" title="엑셀로다운받기"/>
                <input type="button" class="btn_print" onClick="MNG.fncRtnfunc('print','farm');" title="출력하기"/>
				</p>
			</div>
            <table cellpadding="0" cellspacing="1" border="0" class="erpTable">
				<colgroup>
					<col width="4%" />
					<col width="12%" />
					<col width="12%" />
					<col width="12%" />
					<col width="12%" />
					<col width="12%" />
					<col width="12%" />
					<col width="12%" />
					<col width="12%" />
				</colgroup>
<?
	$pagesize 		= 10;
	$pagelistsize 	= 10;
	$totalcount 	= &GetFarmListCount($sch_farm_name);
	$totalpage 	= ceil($totalcount/$pagesize);
	if ($page > $totalpage)
		$page = $totalpage;
	if ($page < 1)
		$page = 1;
	
	$list = & GetFarmList($sch_farm_name, $page, $pagesize);
	
	if ($list->getLength() == 0)
	{
?>
				<tr>
					<td colspan=9>등록된 레코드가 없습니다.</td>
				</tr>
<?
	}
	else
	{
		while ($list->hasNext())
		{
			$row 			= & $list->next();

			$farm_seq            = $row->getString('farm_seq');
			$jbnh_seq	         = $row->getString('jbnh_seq');
			$jbnh_name			 = $row->getString('jbnh_name');
			$farm_name	         = $row->getString('farm_name');
			$farm_address	     = $row->getString('farm_address');
			$farm_tel	         = $row->getString('farm_tel');
			$farm_itemcode1      = $row->getString('farm_itemcode1');
			$farm_itemname1      = $row->getString('farm_itemname1');
			$farm_regnumber	     = $row->getString('farm_regnumber');
			$farm_certnumber	 = $row->getString('farm_certnumber');
			$farm_gapnumber	     = $row->getString('farm_gapnumber');
			$farm_tracenumber	 = $row->getString('farm_tracenumber');
			$farm_certdate	     = $row->getString('farm_certdate');
			$farm_memo	         = $row->getString('farm_memo');
			$farm_regdate	  	 = $row->getString('farm_regdate');
			
			
			
			//html스크립트 인코딩
			$farm_name	         = nohtml($farm_name);
			$farm_address	     = nohtml($farm_address);
			$farm_tel	         = nohtml($farm_tel);
			$farm_regnumber	     = nohtml($farm_regnumber);
			$farm_certnumber	 = nohtml($farm_certnumber);
			$farm_gapnumber	     = nohtml($farm_gapnumber);
			$farm_tracenumber	 = nohtml($farm_tracenumber);
			$farm_certdate	     = nohtml($farm_certdate);
			$farm_memo	         = nohtml($farm_memo);
			
			$farm_itemname2 = GetFarmItem2ListHTML($farm_seq, $farm_itemcode1);
?>
            	<tr>
					<td rowspan="4"><input type="checkbox" id="chkbxNo" name="chkbxNo" value="<?echo $farm_seq?>" title="수정 및 삭제시 클릭" /></td>
                    <th>소속농협</th>
					<td><?echo $farm_name?></td>
                    <th>생산자</th>
					<td><?echo $farm_name?></td>
                    <th>주소</th>
					<td colspan="3"><?echo $farm_address?></td>
				</tr>
				<tr>
					<th>품목</th>
					<td><?echo $farm_itemname1?></td>
					<th>품종</th>
					<td><?echo $farm_itemname2?></td>
					<th>인증만료기간</th>
					<td colspan="3"><?echo $farm_certdate?></td>
				</tr>
				<tr>
					<th>출하자<br />신고번호</th>
					<td><?echo $farm_regnumber?></td>
                    <th>품질<br />인증번호</th>
					<td><?echo $farm_certnumber?></td>
                    <th>이력추적<br />관리번호</th>
					<td><?echo $farm_tracenumber?></td>
					<th>GAP<br />인증번호</th>
					<td><?echo $farm_gapnumber?></td>
				</tr>
				<tr>
					<th>비고사항</th>
					<td colspan="7"><?echo nohtml($farm_memo)?></td>
				</tr>
<?
			}
		}
?>
            </table>
            <div class="BtnList">
            	<ul>
                	<li><input type="button" class="btn_submit" title="등록" OnClick="MNG.fncRtnfunc('reg','farm');"/></li> 
					<li><input type="button" class="btn_modify" title="수정" OnClick="MNG.fncRtnfunc('mod','farm');"/></li> 
					<li><input type="button" class="btn_del" title="삭제" OnClick="MNG.fncRtnfunc('del','farm');" />
                </ul>
            </div>
            
            <div class="pagination">
            	<? printPageList($page, $totalpage, $pagelistsize, $_SERVER['PHP_SELF'], $basic_param); ?>
            </div>
            
        </div>
    </div>   
</form>
	<!-- footer start -->
	<? include("../_layout/footer.inc"); ?>
	<!-- footer end -->
    
</div>
</body>
</html>